package day01;

import java.util.Arrays;

/**
 * @author Jetwang
 * @version 1.0
 * @since 2023/3/21 15:10
 */
public class MaxHeapTest {
    public static void main(String[] args) {
        MaxHeap heap = new MaxHeap(new int[]{2, 3, 1, 7, 6, 5, 4});
        System.out.println(Arrays.toString(heap.array));
        // 堆排序
        while(heap.size > 1) {
            heap.swap(0 , heap.size - 1);
            heap.size--;
            heap.down(0);
        }
        System.out.println(Arrays.toString(heap.array));
    }
}
